package leetcode.leetcode_2598;

class Solution {
    public int findSmallestInteger(int[] nums, int value) {
        int n = nums.length;
        for (int i = 0; i < n; i++) {
            nums[i] = nums[i]%value;
            if (nums[i] < 0) {
                nums[i] += value;
            }
        }
        boolean [] visited = new boolean[value];
        for (int num : nums) {
            visited[num] = true;
        }
        for (int i = 0; i < value; i++) {
            if (!visited[i]) {
                return i;
            }
        }
        return value;
    }
}